# class Stack:
#
#     def __init__(self):
#
#         self.items =[]
#
#     def push(self,item):
#
#         self.items.append(item)
#
#     def pop(self):
#
#         return self.items.pop()
class Stack:
    def __init__(self):
        self.items = []

    def isEmpty(self):  # 判栈空
        return self.items == []

    def push(self, item):  # 进栈
        self.items.append(item)

    def pop(self):  # 出栈
        return self.items.pop()

    def peek(self):  # 获取栈顶元素
        return self.items[len(self.items) - 1]

    def size(self):  # 获取栈的大小
        return len(self.items)


# # 十进制转二进制
# def Switch(Number):
#     remainStack = Stack()
#

#     while Number > 0:
#         remain = Number % 2
#         remainStack.push(remain)
#         Number = Number // 2
#
#     #构建二进制字符串
#     binStr = ''
#
#     while not remainStack.isEmpty():
#         binStr = binStr + str(remainStack.pop())
#
#     return "0b" + binStr
#
#
# print(Switch(int(input('十进制转换二进制: '))))


class Car:

    def __repr__(self):
        return '小汽车'


class Mask:

    def __repr__(self):
        return '口罩'


# car = Car()
#
# print(car)


class SimpleFactory:

    @staticmethod
    def product(name):

        if name == '小汽车':

            return Car()

        elif name == '口罩':

            return Mask()

print(SimpleFactory.product('口罩'))
